#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Author :
import os
from common.path_setting import ensure_path_sep
from common.get_logger import GetLogger

log = GetLogger.get_logger()


def del_file(path):
    """删除目录下的文件"""
    if os.path.exists(path):
        list_path = os.listdir(path)
        for i in list_path:
            c_path = os.path.join(path, i)
            if os.path.isdir(c_path):
                del_file(c_path)
            else:
                os.remove(c_path)


def del_report_file():
    del_file((ensure_path_sep("\\outputs\\reports")))
    log.info("删除报告文件成功")


def del_logs_file():
    del_file((ensure_path_sep("\\outputs\\logs")))
    log.info("删除日志文件成功")


def del_screenshots_file():
    del_file((ensure_path_sep("\\outputs\\screenshots")))
    log.info("删除截图文件成功")


def del_downloads_file():
    del_file((ensure_path_sep("\\outputs\\downloads")))
    log.info("删除下载文件成功")


def del_all_file():
    del_report_file()
    del_logs_file()
    del_screenshots_file()
    del_downloads_file()
    log.info("删除所有文件成功")


if __name__ == '__main__':
    # del_all_file()
    case_name=1
    step_datas=2
    a = f"【{case_name}】的测试步骤的数据为:{step_datas}"
    c = "【%s】的测试步骤的数据为" % case_name
    print(c)
